Bureau of Transportation Statistics¶

airplane-on-world-map.jpg

Air Travel Consumer Report Period From June 2003 to October 2020¶

Types of Delay¶

1.Carrier Delay¶

2.Late Arrival Delay¶

3.NAS Delay¶

4.Security Delay Cause¶

5.Weather Delay Cause¶

Analysis layer¶

1.Airline¶

2.Airport¶

2.State¶

1.Analysis Airline Layer¶

What is the most carrier agent makeing flights?¶

In [52]:
#get the most carrier agent make flights
most_aircraft_flights=carrier_delay_df2.sort_values(by='arr_flights',ascending=False )
most_aircraft_flights.plot(kind="bar",x='carrier_name',y='arr_flights',figsize=(20,10)),sorted
print(most_aircraft_flights['arr_flights'].mean())
plt.show()
1470.2529333333332

What is the most carrier agent makeing delay ?¶

In [53]:
#get the most carrier agent make delay
most_aircraft_delay=carrier_delay_df2.sort_values(by='aircraft_delay(min/flight)',ascending=False )
most_aircraft_delay.plot(kind="bar",x='carrier_name',y='aircraft_delay(min/flight)',figsize=(20,10)),sorted
print(most_aircraft_delay['aircraft_delay(min/flight)'].mean())

plt.show()
53.01640733771036

What is carrier agent make delay more than def avg Delay?¶

In [54]:
#get the most carrier agent make delay more than def_avg_Delay
carrier_delay_df2['def_avg_Delay'] = (carrier_delay_df2['def_avg_Delay'] / 1000)
carrier_delay_df2.plot(kind='area',x='carrier_name',y='def_avg_Delay', color='red',stacked=False ,figsize=(20,10)),sorted
print(most_aircraft_delay['def_avg_Delay'].mean())

plt.show()
5675511.9000122715

2.Analysis Airports Layer¶

What is The Most US Airports had Weather Delay?¶

In [64]:
#us airport distribution by state and Weather Delay info
fig = px.scatter_mapbox(geo, lat="LATITUDE", lon="LONGITUDE", hover_name="AIRPORT_STATE_NAME", hover_data=["AIRPORT_STATE_NAME", "weather_delay(min/flight)"],
                        color_discrete_sequence=["fuchsia"], zoom=3, height=300)
fig.update_layout(mapbox_style="open-street-map")
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()
In [65]:
#get the most airports makeing weather_delay
most_airports_delay=geo.sort_values(by='weather_delay(min/flight)',ascending=False )

most_airports_delay.head(20).plot(kind="bar",x='DISPLAY_AIRPORT_NAME',y='weather_delay(min/flight)',figsize=(20,10)),sorted
print(geo['weather_delay(min/flight)'].mean())
plt.show()
7.83864917649772
In [67]:
#us airport distribution by state and Weather Delay info #using Google API Maps #map view
locations = geo[['LATITUDE', 'LONGITUDE']]
weights = geo['weather_delay(min/flight)']
fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights))
fig

airport%20distribution%20by%20state%20and%20Weather%20Delay-2.png

What is Most US Airport by LONGITUDE,LATITUDE had Flight Cancelled¶

In [68]:
geo.plot(kind="scatter", x="LONGITUDE", y="LATITUDE",
    s=geo['arr_cancelled'], label="Flight Cancelled",
    c="arr_cancelled", cmap=plt.get_cmap("jet"),
    colorbar=True, alpha=0.4, figsize=(20,10),
)

plt.legend()
plt.show()

What is Most US Airport had Carrier Delay?¶

In [69]:
#us airport distribution by state and Weather Delay info #using Google API Maps #satellite view
locations = df_geo_1[['LATITUDE', 'LONGITUDE']]
weights = df_geo_1['carrier_delay(min/flight)']
fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights))
fig

What%20is%20Most%20US%20Airport%20had%20Carrier%20Delay.png

3.Analysis State Layer¶

What is The Most US State had Weather Delay?¶

In [75]:
#get the most state makeing weather_delay

most_state_delay=most_state_delay.sort_values(by='weather_delay(min/flight)',ascending=False )
most_state_delay.plot(kind="bar",x='STATE_NAME',y='weather_delay(min/flight)',figsize=(20,10)),sorted
print(most_state_delay['weather_delay(min/flight)'].mean())
plt.show()
39.75564591352922
In [76]:
#us state and Weather Delay info #using Google API Maps #satellite view
locations = most_state_delay[['latitude', 'longitude']]
weights = most_state_delay['weather_delay(min/flight)']
fig = gmaps.figure()
fig.add_layer(gmaps.heatmap_layer(locations, weights=weights))
fig

What%20is%20The%20Most%20US%20State%20had%20Weather%20Delay-2.png

4. Data Visualization¶

Project 3.Communicate Data Findings¶